<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        var a={};
        var b={
            x:12,
            y:"完整",
            z:function (){
                console.log("久久");
            }
        }
//創建
        var c=new Object();
        var d=new Array();
        var e=new Date();
        var f=new RegExp();
//获取 变量.   字符串[]
        console.log(b.x);
        console.log(b["y"]);
//对象的方法
        delete b.x;
        "x" in b;
        b.hasOwnProperty("x");
        b.propertyIsEnmuerable("x")
//this问题
        //一般来说--this指向 他的调用者  一名函数 全局window
        //事件的this 值节点
        function add(){
            console.log(this);
            console.log(this.y);
        }
        ~function ad(){
            console.log(this);
        }()
        var c={
            y:12,
            x:function(){
                console.log(this);
            }
        }
        add.apply(c)

//数据的分析
        var d={
            y:12,
            x:function(){
                console.log(this);
            }
        }
        Object.getOwnPropertyDescriptor(d,"y")
        Object.defineProperty(d,"y",{
            configurable:true,
            enumerable:true,
            writable:false,
            value:"久久"
        })
        Object.defineProperty(d,"y",{
            configurable:true,
            enumerable:true,
            writable:false,
            value:"久久"
        })
        var book={
            _year:2004,
            edit:1
        }

        Object.defineProperty(book,"year",{
            configurable:true,
            enumerable:true,
            get:function (){
                return this._year;
            },
            set:function(newValue){
                if (newValue>2004) {
                    this._year=newValue;
                    this.edit +=newValue -2004;
                }
            }
        })
    </script>
</body>
</html>